namespace SimpleWebServices.Web.Mvc
{
    using System;
    using System.Globalization;
    using System.Web.Mvc;
    using System.Web.Routing;
    using SimpleWebServices.Models;
    using SimpleWebServices.Web.Routing;

    [InternalServerError]
    [Allow(Methods = "GET, HEAD, OPTIONS")]
    [CacheControl, ContentLanguage, ContentLocation, ContentMD5]
    public sealed class TenantHtmlResultController : TenantController, IRegisterRoutes
    {
        public void Register(RouteCollection routes)
        {
            if (null == routes)
            {
                throw new ArgumentNullException("routes");
            }

            routes.Add(new HtmlResultRoute(this.GetType()));
        }

        [ContentNegotiation(".html", "*/*, text/*, text/html")]
        public ActionResult HtmlRepresentation(CultureInfo language)
        {
            return this.HtmlView(language, HttpContextFactory.Current.Request.Tokenized<HtmlResult>());
        }

        [ContentNegotiation(".xhtml", "application/xhtml+xml")]
        public ActionResult XhtmlRepresentation(CultureInfo language)
        {
            return this.XhtmlView(language, HttpContextFactory.Current.Request.Tokenized<HtmlResult>());
        }
    }
}